#include "atomic_0701_daodanxx.h"

int generate_random_missile_state(MissileStateInput *input, MissileStateOutput *output)
{
    static std::mt19937 rng(std::random_device{}());

    // 定义各参数的合理范围
    std::uniform_real_distribution<double> velocity_dist(0.0, 3000.0);  // 速度 (m/s)
    std::uniform_real_distribution<double> altitude_dist(0.0, 30000.0); // 高度 (m)
    std::uniform_real_distribution<double> angle_dist(-90.0, 90.0);     // 角度 (度)
    std::uniform_real_distribution<double> accel_dist(-50.0, 50.0);     // 加速度 (m/s²)
    std::uniform_real_distribution<double> lat_dist(-90.0, 90.0);       // 纬度
    std::uniform_real_distribution<double> lon_dist(-180.0, 180.0);     // 经度
    std::uniform_real_distribution<double> time_dist(0.0, 86400.0);     // 时间戳 (秒)

    output->velocity = velocity_dist(rng);
    output->altitude = altitude_dist(rng);
    output->angle = angle_dist(rng);
    output->acceleration_x = accel_dist(rng);
    output->acceleration_y = accel_dist(rng);
    output->acceleration_z = accel_dist(rng);
    output->gps_latitude = lat_dist(rng);
    output->gps_longitude = lon_dist(rng);
    output->timestamp = time_dist(rng);

    return ATOMIC_SERVICE_SUCCESS;
}